package com.jxw.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.jxw.launcher.R;
import com.jxw.launcher.model.CustomizeApp;
import java.util.List;

/* loaded from: classes.dex */
public class FragmentGridViewAdapter extends BaseAdapter {
    private Context context;
    private List<CustomizeApp> strList;

    @Override // android.widget.Adapter
    public long getItemId(int i) {
        return i;
    }

    public FragmentGridViewAdapter(Context context, List<CustomizeApp> list) {
        this.context = context;
        this.strList = list;
    }

    public void setData(List<CustomizeApp> list) {
        this.strList = list;
    }

    @Override // android.widget.Adapter
    public int getCount() {
        return this.strList.size();
    }

    @Override // android.widget.Adapter
    public CustomizeApp getItem(int i) {
        return this.strList.get(i);
    }

    @Override // android.widget.Adapter
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder viewHolder;
        if (view == null) {
            view = LayoutInflater.from(this.context).inflate(R.layout.item_fragment_app, viewGroup, false);
            viewHolder = new ViewHolder();
            viewHolder.name_app = (TextView) view.findViewById(R.id.name_app);
            viewHolder.icon_app = (ImageView) view.findViewById(R.id.icon_app);
            view.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) view.getTag();
        }
        CustomizeApp customizeApp = this.strList.get(i);
        viewHolder.name_app.setText(customizeApp.appName);
        viewHolder.icon_app.setBackgroundResource(customizeApp.resDraw);
        viewHolder.icon_app.setTag(this.context.getString(customizeApp.tagRes));
        return view;
    }

    /* loaded from: classes.dex */
    class ViewHolder {
        ImageView icon_app;
        TextView name_app;

        ViewHolder() {
        }
    }
}
